//
//  RxMVVMTestVC.swift
//  CooperSwift_Example
//
//  Created by 计海峰 on 2021/5/6.
//  Copyright © 2021 CocoaPods. All rights reserved.
//

import UIKit
import RxSwift

class RxMVVMTestVC: UIViewController {
    
    var vm = RxMVVMTestVM()

    let disposeBag = DisposeBag()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        view.backgroundColor = .white
        
        vm.navigationTitle.bind(to: self.navigationItem.rx.title).disposed(by: disposeBag)
        
        
        let btn = UIButton.init(frame: CGRect.init(x: 20, y: 120, width: 44, height: 44))
        btn.backgroundColor = .random()
        view.addSubview(btn)
        
        btn.rx.tap.asObservable().subscribe(onNext:  { _ in
            print("btn tap")
        }).disposed(by: disposeBag)
        
        // Do any additional setup after loading the view.
    }


    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destination.
        // Pass the selected object to the new view controller.
    }
    */

}
